<?php
	require_once('../libraryfiles/config.php');
	checkAccountType();		
	$content = 'editProductPrice.php';
	$_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI'];	
	$word = '';
	$include='<link rel="stylesheet" type="text/css" href="../css/mStyle.css">
			<link rel="stylesheet" type="text/css" href="../css/style.css">
			<script src="'.W_ROOT.'/js/common.js" type="text/javascript"></script>
			<script src="'.W_ROOT.'/js/jquery.js" type="text/javascript"></script>
			';
	require_once TMP_USER_PATH;
	
	if(isset($_POST['btnsearch'])){
		$word = $_POST['txtsearch'];
		$sql2 = "tblproduct.product_name LIKE '$word%' AND ";	
	}else{
		$sql2 = '';	
	}
	
	$rowsPerPage = isset($_GET['num'])?$_GET['num']:'20';
	
	$pharma_id = $_SESSION['acc_id'];
	$sql = "SELECT tblproduct.product_name,tblproduct.id, tblproduct_in_pharmacy.* FROM tblproduct, tblproduct_in_pharmacy WHERE $sql2  tblproduct.id=tblproduct_in_pharmacy.product_id AND tblproduct_in_pharmacy.pharmacy_id = $pharma_id";
	$result     = mysql_query(getPagingQuery($sql, $rowsPerPage));
	$pagingLink = getPagingLink($sql, $rowsPerPage);
?>
<form action="#" name="frmeditprice" method="post">
<div class="row">
	<div class="nine columns">
<div class="eidtProductPrice">
     <div class="block-header">
            <h4>Edite Product Price</h4>
        </div>
    <div id="search_wrapper">
    	<div id="searchbox"><input type="text" name="txtsearch" style="width:300px; margin-top:30px; height:30px;" value="<?php echo $word;?>"/>
        <input type="submit" value="Search" name="btnsearch" style="  height: 38px; margin-left: 311px; margin-top: -37px; position: absolute; width:85px;"/></div>
    	<div id="savebox"><input  style="float: right; height: 38px; margin-right:-100px;margin-top: -37px; width: 85px;"type="button" value="Save" name="btnsave" onclick="document.frmeditprice.action='<?php echo W_ROOT;?>/seller/product/process.php?action=updatePrice';document.frmeditprice.submit();" /></div>
    </div>
    <div class="center">
    	<table  class="table table-striped"cellspacing="0" cellpadding="5" style="margin-top:5px;">
         	<tr>
            	<td class="p_l" align="center" width="20">N&deg;</td>
                <td class="p_l" style="padding-left:15px;">Product Name</td>
                <td width="100" align="center">Price ($)</td>
            </tr>
            <?php
			if(dbNumRows($result)){
				$i = 0;
			while($row = mysql_fetch_assoc($result)){
				
					extract($row);
	
				if($i%2){
					$class = 'row1';	
				}else{
					$class = 'row2';	
				}
				$i++;
			?>
        	<tr class="<?php echo $class?>">
            	<td align="center" class="p_l"><?php echo idFormat($i);?></td>
                <td class="p_l" style="padding-left:15px;"><strong style="color:#06C;"><?php echo $product_name?></strong><br />
        <em style="color:#666;">( Made in <?php echo getCountryName($country_id);?> )</em></td>
                <td align="center"><input type="text" id="price" style="width:80px;" value="<?php echo $price?>" name="price<?php echo $pid?>" />
                <input type="hidden" name="hidepid[]" value="<?php echo $pid?>" />
                </td>
            </tr>
            <?php
			}// end while
			}// end if
			?>
        </table>
    </div>
    </div>
    <div class="title1">
<div style="float:left; padding-top:2px;"></div>
view per page
        <select class="right span4" name="numpage" onchange="viewEditByNumPage();">
        <option value="10" <?php echo($rowsPerPage==10)?' selected="selected"':'';?>>10</option>
        <option value="20" <?php echo($rowsPerPage==20)?' selected="selected"':'';?>>20</option>
        <option value="30" <?php echo($rowsPerPage==30)?' selected="selected"':'';?>>30</option>
        <option value="40" <?php echo($rowsPerPage==40)?' selected="selected"':'';?>>40</option>                                
        <option value="50" <?php echo($rowsPerPage==50)?' selected="selected"':'';?>>50</option>        
        <option value="100" <?php echo($rowsPerPage==100)?' selected="selected"':'';?>>100</option>        
        <option value="200" <?php echo($rowsPerPage==200)?' selected="selected"':'';?>>200</option>        
        </select></div>
</div>
</form>
  <aside class="three columns">
        <?php 
    		include('left.php');
    	?>
    </aside><!--<div class="three columns">-->